
package com.abcijkxyz.dialects.stsm.score;

import java.util.HashSet;
import java.util.Set;

import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;
import org.thymeleaf.standard.processor.StandardXmlNsTagProcessor;
import org.thymeleaf.templatemode.TemplateMode;

/**
 * 控制比赛成绩显示内容的内容自定义标签集合
 * 
 * @author root
 *
 */
public class ScoreDialect extends AbstractProcessorDialect {

	private static final String DIALECT_NAME = "Score Dialect";

	public ScoreDialect() {
		// We will set this dialect the same "dialect processor" precedence as
		// the Standard Dialect, so that processor executions can interleave.
		super(DIALECT_NAME, "score", StandardDialect.PROCESSOR_PRECEDENCE);
	}

	/*
	 * Two attribute processors are declared: 'classforposition' and 'remarkforposition'. Also one element processor: the 'headlines' tag.
	 */
	public Set<IProcessor> getProcessors(final String dialectPrefix) {
		final Set<IProcessor> processors = new HashSet<IProcessor>();
		processors.add(new ClassForPositionAttributeTagProcessor(dialectPrefix));
		processors.add(new RemarkForPositionAttributeTagProcessor(dialectPrefix));
		processors.add(new HeadlinesElementTagProcessor(dialectPrefix));
		processors.add(new MatchDayTodayModelProcessor(dialectPrefix));
		// This will remove the xmlns:score attributes we might add for IDE validation
		processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix));
		return processors;
	}

}
